<!DOCTYPE html>
<head>
	<title>Login One</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link href="/static/index/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="/static/index/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="/static/index/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
	<link href="/static/index/css/templatemo_style.css" rel="stylesheet" type="text/css">
	<script src="/static/index/js/jquery-1.8.3.min.js"></script>
</head>
<body class="templatemo-bg-gray">
	<div class="container">
		<div class="col-md-12">
			<h1 class="margin-bottom-15">修改密码</h1>
			<form class="form-horizontal templatemo-container templatemo-login-form-1 margin-bottom-30" role="form" action="{:url('index/login/doReset')}" method="post" onsubmit="return reEditFrom();">
				<div class="form-group">
					<div class="col-md-12">
						<div class="templatemo-input-icon-container">
							<i class="fa fa-lock"></i>
							<input type="password" class="form-control" onblur="rePassword();" id="password" name="password" placeholder="新密码">
						</div>
					</div>
					<div class="col-md-12 middle"></div>
				</div>

				<div class="form-group">
					<div class="col-md-12">
						<div class="templatemo-input-icon-container">
							<i class="fa fa-lock"></i>
							<input type="password" class="form-control" onblur="rePwd();" id="pwd" name="pwd" placeholder="确认密码">
						</div>
					</div>
					<div class="col-md-12 middle"></div>
				</div>

				<div class="form-group">
					<div class="col-md-12">
						<input type="submit" class="btn btn-primary  form-control"  value="提交">
					</div>

				</div>
		      
		      </form>
		</div>
	</div>
	<script>
        function rePassword(){
            var password = $('#password').val();
            if(!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,21}$/.test(password)){
                $('.middle').eq(0).html('只能是6-21个字母、数字组合而成').css({'color': 'red'});
                return false;
            }else{
                $('.middle').eq(0).html('正确').css({'color': 'green'});
                return true;
            }
        }

        function rePwd(){
            var pwd = $('#pwd').val();
            var password = $('#password').val();
            if(pwd !== password || pwd === ''){
                $('.middle').eq(1).html('两次密码不一致,不能为空').css({'color': 'red'});
                return false;
            }else{
                $('.middle').eq(1).html('正确').css({'color': 'green'});
                return true;
            }
        }

        function reEditFrom(){
            return rePassword() && rePwd();
        }

	</script>
</body>
</html>